{include file="admin/head" /}
<body>
<div class="x-body">
    <form class="layui-form">
    <div class="layui-form-item">
        <label for="" class="layui-form-label">课室名称</label>
        <div class="layui-input-block">
            <input type="text" id="name" class="layui-input" placeholder="请输入课室名称" value="{$lab.name}">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="" class="layui-form-label">课室地址</label>
        <div class="layui-input-block">
            <input type="text" id="address" class="layui-input" placeholder="请输入课室地址" value="{$lab.address}">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="" class="layui-form-label">承载人数</label>
        <div class="layui-input-inline">
            <input type="text" id="people" class="layui-input" placeholder="请输入承载人数" value="{$lab.people}">
        </div>
        <div class="layui-form-mid">
            只可以输入数字
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">管理教师</label>
        <div class="layui-input-inline">
            <select lay-verify="required" name="teacher_id" id="teacher_id">
                <option value="" id="null"></option>
                {volist name="teachers" id="teacher"}
                <option value="{$teacher.id}"  {eq name="$lab.teacher_id" value="$teacher.id"}selected="selected"{/eq}>{$teacher.realname}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" type="button" onclick="fuck()">修改课室</button>
        </div>
    </div>
    </form>
</div>

<script>
    function fuck() {
        $.post(
            "",
            {
                name:$('#name').val(),
                address:$('#address').val(),
                people:$('#people').val(),
                teacher_id:$('#teacher_id').val()
            },
            function (data) {
                layui.use('layer', function(){
                    var layer = layui.layer;
                    if (data.statu==200){
                        layer.msg(data.msg);
                        $('#name').val('');
                        $('#address').val('');
                        $('#people').val('');
                    } else {
                        layer.msg(data.msg);
                    }
                });
            }
        )
    }
</script>
</body>

</html>